export const getLowercase = (data: any[], tabKey?: string) => {
  return data.map((item) => {
    let _obj = {};
    for (const key in item) {
      _obj[key.toLowerCase()] = item[key];
    }
    if (tabKey) {
      _obj['key'] = `${tabKey}-${_obj?.['identityid']}`;
    }
    return _obj;
  });
};

export function getParents(el: any, parentSelector: any /* optional */) {
  // If no parentSelector defined will bubble up all the way to *document*
  if (parentSelector === undefined) {
    parentSelector = document;
  }

  var parents = [];
  var p = el.parentNode;

  while (p !== parentSelector) {
    var o = p;
    if (o == null) {
      return [];
    }
    parents.push(o);
    p = o.parentNode;
  }
  parents.push(parentSelector); // Push that parentSelector you wanted to stop at
  return parents;
}